//
//  NSMutableArray+Random.m
//  cascade-realm
//
//  Created by QSC on 30/5/24.
//

#import "NSMutableArray+Random.h"

@implementation NSMutableArray (Random)
- (void)randomObjects
{
    [self sortUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        int32_t randomResult = (int32_t)arc4random() % 3 - 1; // arc4random() 返回值为 u_int32_t，不能为负数，先转为 int32_t
        return randomResult;
    }];
}
@end
